package common.service.impl;

import common.pojo.User;
import common.service.UserService;

import java.util.Random;
import java.util.UUID;

public class UserServiceImpl implements UserService {
    @Override
    public User getUserById(Integer id) {
        System.out.println("客户端查询了" + id + "号用户");
        // 模拟从数据库中查询用户
        Random random = new Random();
        return User.builder()
                .userName(UUID.randomUUID().toString().substring(0, 5))
                .id(id)
                .sex(random.nextBoolean()).build();
    }

    @Override
    public Integer insertUserId(User user) {
        System.out.println("客户端插入用户" + user.getUserName());
        return user.getId();
    }
}
